import {
  queryTempFunctionCode
} from '../../../utils/login'
import {saveMatter} from '../../../utils/my'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    menuInfo: {},
    str: [{
        id: '1',
        name: '失业登记',
        url: '/pages/ObtainEmployment/register/register',
        code: 'JYCY_0001',
        icon:'jycy1'
      },
      {
        id: '2',
        name: '失业登记查询',
        url: '/pages/ObtainEmployment/Unemployment_select/Unemployment_select',
        code: 'JYCY_0033',
        icon:'jycy2'
      },
      {
        id: '6',
        name: '就业创业证查询',
        code: 'JYCY_0032',
        icon:'jycy3'
      },{
        id: '7',
        name: '就业困难人员认定',
        code: 'JYCY_0041',
        icon:'jycy4'
      },{
        id: '8',
        name: '个人就业见习岗位申请',
        code: 'JYCY_0035',
        icon:'jycy5'
      },
      // ,{
      //   id: '9',
      //   name: '求职招聘',
      //   code: 'JYCY_0098',
      //   icon:'jycy6'
      // },{
      //   id: '10',
      //   name: '长三角招聘专区',
      //   code: 'JYCY_0039',
      //   icon:'jycy7'
      // },
      {
        id: '11',
        name: '用工备案信息查询',
        code: 'JYCY_0082',
        icon:'jycy8'
      },
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    //设置头部字体与导航栏对齐
    const top = getApp()
    this.setData({
      menuInfo: top.geibartop.menuInfo
    })
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },
  //跳转页面
  jumpPage(e) {
    const code = e.currentTarget.dataset.code;
    const name = e.currentTarget.dataset.name;
    if(code){
      queryTempFunctionCode(code).then(res => {
        saveMatter(name) //保存事项
        wx.navigateTo({
          url: '/pages/web_h5/web_h5?url=' + encodeURIComponent(res.data)
        })
      })
    }else{
      wx.showToast({
        title: '功能代码错误！',
        icon: 'error',
        duration: 2000
      })
    }
  },
  //返回上一级
  backPage() {
    wx.navigateBack({
      delta: 1
    });
  },
})